//
//  KaihuzhongxinvC.m
//  SSC
//
//  Created by 红沙尘 on 17/6/10.
//  Copyright © 2017年 红沙尘. All rights reserved.
//

#import "KaihuzhongxinvC.h"

@interface KaihuzhongxinvC ()
{
    __weak IBOutlet UIButton *sureBtn;
    __weak IBOutlet UITextField *nameField;
    __weak IBOutlet UITextField *psdField;
    __weak IBOutlet UITextField *koudianField;
    
}
@end

@implementation KaihuzhongxinvC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setTitle:@"开户中心"];
}

- (IBAction)sure {
    
    if (![MTool judgePassWordLegal:nameField.text]) {
        [MTool showAlertController:self message:@"用户名为6-16个数字与字母的组合"];
        
        return;
    }
    
    if (![MTool judgePassWordLegal:psdField.text]) {
        [MTool showAlertController:self message:@"密码为6-16个数字与字母的组合"];
        
        return;
    }
    
    [LoadingView show];
    
    [SSCRequest regWithUsername:nameField.text
                       password:psdField.text
                        success:^(NSDictionary *responseObject)
    {
        [LoadingView diss];
        [MTool showMessage:@"开户成功" inView:nil];
        [self.navigationController popViewControllerAnimated:YES];
    } fail:^(NSError *error) {
        [LoadingView diss];
    }];
}

- (void)setupUI {
    sureBtn.layer.cornerRadius  = 2;
    sureBtn.layer.masksToBounds = YES;
}

@end
